{extend name="public:base" /}

{block name="breadcrumb"}
<ul class="breadcrumb">
    <li>
        <i class="ace-icon fa fa-home home-icon"></i>
        系统设置
    </li>
    <li><a href="{:url('lists')}">角色管理</a></li>
    <li class="active">配置权限</li>
</ul>
{/block}

{block name="content"}
<div class="page-header">
    <h1>
        您当前操作
        <small>
            <i class="ace-icon fa fa-angle-double-right"></i>
            配置权限
        </small>
    </h1>
</div>

<div class="row">
    <div class="col-xs-12">
        <form class="form-horizontal ajaxForm2" name="admin_group_runaccess" method="post" action="{:url('admin_group_runaccess')}">
            <input name="id" id="id" type="hidden" value="{$admin_group.id}" />
            <div class="form-group">
                <label class="col-sm-2 control-label no-padding-right" for="form-field-1"> 用户组名：  </label>
                <div class="col-sm-10">
                    <input type="text" name="title" id="title" value="{$admin_group.title}" class="col-xs-10 col-sm-4" />
                </div>
            </div>
            <div class="space-4"></div>

            <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td height="30" style="border-bottom:#CCCCCC solid 1px; line-height:25px;">配置规则:<br />
                        1、由于页面原因，权限分配为四级，同时控制左侧导航以及用户权限<br />
                        2、部分不需要分配的权限需要在AUTH的控制器里手动添加<br />
                    </td>
                </tr>
                <tr>
                    <td height="30" style="padding-left:10px;border-bottom:#CCCCCC solid 1px; line-height:25px; background-color:#F4F8FB">
                        <label class="pos-rel">
                            <input type="checkbox" class="ace ace-checkbox-2"  id='chkAll' onclick='CheckAll(this.form)' value="全选"/>
                            <span class="lbl"> 权限全选</span>
                        </label>
                    </td>
                </tr>
                {foreach name="datab" item="vo"}
                    <tr>
                        <td height="40" style="border-bottom:#CCCCCC solid 1px;padding-left:10px;">
                            <label>
                                <input {if condition="strstr($admin_group['rules'],$vo['id']) eq true"}checked{/if} name="new_rules[]" class="ace ace-checkbox-2 checkbox-parent" type="checkbox"  value="{$vo.id}" dataid="id-{$vo['id']}" /><span class="lbl"> <strong>{$vo.title}</strong></span>
                            </label>
                        </td>
                    </tr>
                    {foreach name="vo['sub']" item="sub"}
                        <tr>
                            <td height="30" style="padding-left:30px;border-bottom:#E7EBF8 dashed 1px; color:#333333">
                                <label>
                                    <input {if condition="strpos($admin_group['rules'],','.$sub['id'].',') GT -1 "}checked{/if} name="new_rules[]" id="{$sub.id}" class="ace ace-checkbox-2 checkbox-parent checkbox-child" type="checkbox"  value="{$sub.id}" dataid="id-{$vo['id']}-{$sub['id']}" /><span class="lbl"> {$sub.title}</span>
                                </label>
                            </td>
                        </tr>
                        {foreach name="sub['sub']" item="subb"}
                            <tr>
                                <td height="30" style="padding-left:50px;border-bottom:#E7EBF8 dashed 1px; color:#666666">
                                    <label class="thopen">
                                        <input {if condition=" strpos($admin_group['rules'],','.$subb['id'].',') GT -1 ">checked{/if} name="new_rules[]" class="ace ace-checkbox-2 checkbox-parent checkbox-child" type="checkbox"  id="{$subb.id}" value="{$subb.id}" dataid="id-{$vo['id']}-{$sub['id']}-{$subb['id']}" />
                                        <span class="lbl" style="margin-right:20px;"> {$subb.title}</span>
                                    </label>
                                </td>
                            </tr>
                            {if condition="!empty($subb['sub'])"}
                                <tr>
                                    <td height="30" style="padding-left:70px;border-bottom:#E7EBF8 dashed 1px; color:#666666">
                                        {volist name="subb['sub']" id="subbb"}
                                            <label class="thopen">
                                                <input {if condition=" strpos($admin_group['rules'],','.$subbb['id'].',') GT -1 "}checked{/if} name="new_rules[]" class="ace ace-checkbox-2 checkbox-child" type="checkbox"  id="{$subbb.id}" value="{$subbb.id}" dataid="id-{$vo['id']}-{$sub['id']}-{$subb['id']}-{$subbb['id']}" />
                                                <span class="lbl" style="margin-right:20px;"> {$subbb.title}</span>
                                            </label>
                                        {/volist}
                                    </td>
                                </tr>
                            {/if}
                        {/foreach}
                    {/foreach}
                {/foreach}
            </table>
            <div class="clearfix form-actions">
                <div class="col-md-offset-3 col-md-9">
                    <button class="btn btn-info" type="submit">
                        <i class="ace-icon fa fa-check bigger-110"></i>
                        保存
                    </button>

                    &nbsp; &nbsp; &nbsp;
                    <button class="btn" type="reset">
                        <i class="ace-icon fa fa-undo bigger-110"></i>
                        重置
                    </button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}